package com.ruima.framework.db.impl;

import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import javax.sql.rowset.CachedRowSet;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.ruima.framework.dao.DaoUtil;
import com.ruima.framework.dao.IRmAppShishicai;
import com.ruima.framework.dao.IRmSysUser;
import com.ruima.framework.entity.RmAppShishicai;
import com.ruima.framework.entity.RmSysUser;

public class RmAppShishicaiImpl implements IRmAppShishicai {

	private static Log LOG = LogFactory.getLog(RmAppShishicaiImpl.class);
	
	public List<RmAppShishicai> getRmAppShishicais() throws SQLException{
		List<RmAppShishicai> list = new ArrayList<RmAppShishicai>();
		
		String execSql = "select * from rm_app_shishicai";
		
		LOG.info(String.format("exec the sql [%s],time: [%s]", execSql,new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date())));
		CachedRowSet crs = DaoUtil.SimpleQuery(execSql); 
		
		while(crs.next()){
			RmAppShishicai rmAppShishicai  = new RmAppShishicai();
			rmAppShishicai.setObjid(crs.getString("objid"));
			rmAppShishicai.setNumber(crs.getString("number"));
			rmAppShishicai.setDate(new SimpleDateFormat("yyyy-MM-dd").format(crs.getDate("date")));
			
			rmAppShishicai.setA(crs.getString("a"));
			rmAppShishicai.setB(crs.getString("b"));
			rmAppShishicai.setC(crs.getString("c"));
			rmAppShishicai.setD(crs.getString("d"));
			rmAppShishicai.setE(crs.getString("e"));
			
			list.add(rmAppShishicai);
		}
		
		return list;
	}
	public static void main(String[] args) throws SQLException {
		new RmAppShishicaiImpl().getRmAppShishicais();
	}
}
